package com.athenaeum.datastore.service.impl;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.athenaeum.datastore.criteria.MailCriteria;
import com.athenaeum.datastore.domain.Mail;
import com.athenaeum.datastore.repository.MailRepository;
import com.athenaeum.datastore.service.MailService;

@Service
public class MailServiceImpl implements MailService {

	@Resource
	private MailRepository mailRepository;

	@Override
	public Mail save(Mail mail) {
		return mailRepository.save(mail);
	}

	@Override
	@Transactional(readOnly = true)
	public Mail find(String id) {
		return mailRepository.findOne(id);
	}

	@Override
	public Page<Mail> getByCriteria(MailCriteria criteria, Pageable pageable) {
		return mailRepository.getByCriteria(criteria, pageable);
	}
	
}
